<?php
/**
 * Created by PhpStorm.
 * User: sks
 * Date: 2015/12/15
 * Time: 13:49
 */

class Involved_AdModel extends BaseModel{

    protected $table = 'ad';

    /**
     * 广告位列表
     * @return mixed
     */
    public function AdsList()
    {
        return  DB::table($this->table)
            ->orderBy('auto_id', 'desc')
            ->get();
    }

    /**
     * 首页banner数据
     * @return mixed
     */
    public function BannerIndex($type)
    {
        return  DB::table($this->table)
            ->select('auto_id','ad_name','img_url','link')
            ->where('type',$type)
            ->where('is_rec','1')
            ->orderBy('order_by', 'asc')
            ->get();
    }


    public function GetAdsInfo($auto_id)
    {
        return DB::table($this->table)->where('auto_id',$auto_id)->first();
    }

    /**
     * API
     */
    public function FinancingBanner()
    {
        return   DB::table($this->table)
            ->select('img_url','link')
            ->where('type','4')
            ->where('is_rec','1')
            ->orderBy('auto_id', 'desc')
            ->get();
    }


}